﻿using Microsoft.AspNetCore.Mvc;
using StarsAdmin.Web.Core.Filter;

namespace StarsAdmin.Web.Core.Extensions
{
    public static class FilterExtension
    {
        public static void RegisterGlobalFilter(this MvcOptions options)
        {
            // 添加鉴权过滤器
            options.Filters.Add<AuthenticationFilter>();
            // 添加全局异常过滤器
            options.Filters.Add(typeof(GlobalExceptionsFilter));
            // 添加操作日志过滤器
            options.Filters.Add(typeof(ControllerLogFilter));
            // 执行耗时
            options.Filters.Add(typeof(TimeFilter));
        }
    }
}